﻿<!doctype html>
<html>
    <head>
    <title>SpreadJS - Functions</title>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>

    <link href="../../../external/spreadjs/css/gcspread.sheets.excel2013white.9.40.20161.0.css" rel="stylesheet" type="text/css" />

    <script src="../../../external/external/jquery-1.8.2.min.js" type="text/javascript"></script>

    <script type="text/javascript" src="../../../external/spreadjs/gcspread.sheets.all.9.40.20161.0.min.js"></script>

    <style type="text/css">
    /*css_begin*/

    /*css_end*/
    </style>
    <script id="scriptInit" type="text/javascript">
        /*code_begin*/
        $(document).ready(function () {
            var spread = new GcSpread.Sheets.Spread(document.getElementById("ss"), { sheetCount: 1 });
            initSpread(spread);
        });
        function initSpread(spread) {
            var spreadNS = GcSpread.Sheets;
            
            var sheet = spread.getSheet(0);

            sheet.isPaintSuspended(true);
            sheet.addSpan(1, 2, 1, 2);
            sheet.setText(2, 2, "Age");
            sheet.getCell(3, 0).value("Name").vAlign(spreadNS.VerticalAlign.center);
            sheet.setValue(3, 1, "Jack");
            sheet.setValue(4, 1, "Lily");
            sheet.setValue(5, 1, "John");
            sheet.setValue(6, 1, "Mary");
            sheet.setValue(3, 2, 19);
            sheet.setValue(4, 2, 21);
            sheet.setValue(5, 2, 22);
            sheet.setValue(6, 2, 25);
            sheet.setText(7, 0, "Average Age:");
            sheet.setText(8, 0, "Max Age:");
            sheet.setText(9, 0, "Min Age:");
            sheet.addSpan(7, 0 , 1, 2);
            sheet.addSpan(8, 0 , 1, 2);
            sheet.addSpan(9, 0 , 1, 2);
            sheet.setFormula(7, 2, "=AVERAGE(C4:C7)");
            sheet.setFormula(8, 2, "=MAX(C4:C7)");
            sheet.setFormula(9, 2, "=MIN(C4:C7)");

            sheet.isPaintSuspended(false);
        };
        /*code_end*/
    </script>
    </head>
    <body>
    <div class="sample-turtorial">
        <div id="ss" style="width:100%; height:430px;border: 1px solid gray;"></div>
    </div>
    </body>
</html>